<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
<h:body>
    <h:form id="addEmployeeDialogForm">
        <p:growl id="growl" showDetail="true" life="3000"/>
        <h:panelGrid columns="2" cellpadding="10" cellspacing="10">
            <h:outputLabel for="employee_name" value="ФИО сотрудника: "/>
            <p:inputText id="employee_name" value="#{employeesBean.employee.name}" required="true"/>

            <h:outputLabel for="employee_post" value="Должность: "/>
            <p:selectOneMenu id="employee_post" value="#{employeesBean.employee.posts.name}"
                             effect="fold">
                <f:selectItem itemLabel="Выберите должность: " itemValue="" />
                <f:selectItems value="#{employeesBean.posts}" />
            </p:selectOneMenu>

            <h:outputLabel for="employee_date" value="Дата приёма на работу: "/>
            <p:calendar value="#{employeesBean.employee.startDate}" id="employee_date" showButtonPanel="true"/>

            <h:outputLabel for="employee_salary" value="Ставка: "/>
            <p:inputText id="employee_salary" value="#{employeesBean.employee.salary}" required="true"/>

            <h:outputLabel for="employee_salary_type" value="Тип ставки: "/>
            <p:selectOneMenu id="employee_salary_type" value="#{employeesBean.employee.salaryType.name}"
                             effect="fold">
                <f:selectItem itemLabel="Выберите тип оклада: " itemValue="" />
                <f:selectItems value="#{employeesBean.salaryType}" />
            </p:selectOneMenu>

            <f:facet name="footer">
                <p:commandButton value="Сохранить" actionListener="#{employeesBean.saveEmployee}"
                                 oncomplete="handleCreateEmployeeRequest(xhr, status, args)" update="growl"/>
            </f:facet>
        </h:panelGrid>
    </h:form>
</h:body>

</html>